﻿
using Microsoft.Maui.Graphics;
using Microsoft.Maui.Graphics.Platform;
using System.Reflection;
using IImage = Microsoft.Maui.Graphics.IImage;

namespace LuoYangHuiPT
{
    /// <summary>
    /// 绘图
    /// </summary>
    public class GraphicsDrawable : IDrawable
    {
        public void Draw(ICanvas canvas, Microsoft.Maui.Graphics.RectF dirtyRect)
        {
            if (ZiYuan.Path=="")
            {
                return;
            }
            IImage image;
            Assembly assembly = GetType().GetTypeInfo().Assembly;
            using (Stream stream = new FileStream(ZiYuan.Path, FileMode.Open))
            {
                image = PlatformImage.FromStream(stream);
            }

            if (image != null)
            {
                canvas.DrawImage(image, 10, 10, image.Width, image.Height);
            }
        }
    }
}
